{% extends "space/base.html" %}

{% block menu_list %}
	<li>+<a href="/space/rest/orders/">订单确认</a></li>
	<li>+<a href="/space/rest/intr/">餐厅介绍</a></li>
	<li>+<a>菜单管理</a>
	<ul>
		<li><a href="/space/rest/cuis/">菜单目录</a></li>
		<li><a href="/space/rest/dish/publish/">发布新菜式</a></li>
		<li><a href="/space/rest/dish/sell/">正在销售</a></li>
		<li><a href="/space/rest/dish/unsell/">未销售菜式</a></li>
		
	</ul>
	</li>
	<li>+<a href="/rest/sell/">销售记录</a></li>
	<li>+<a href="/rest/comments/">评论管理</a></li>           
{% endblock %}
{% block right_container %}
<script type="text/javascript"> 

function deleteIntro(id){
	if(confirm("是否删除?")){
		window.location.href="/space/restIntroImg/"+id+"/del/";
	}
}
function deleteAd(id){
	if(confirm("是否删除?")){
		window.location.href="/space/restAdImg/"+id+"/del/";
	}
}
</script>
<div class="admin_position">商户管理 > 餐厅信息</div>
     <table class="admin_index_table"><tbody>
      <tr>
        <td colspan="6" class="admin_consumption">餐厅信息</td>
      </tr>
      <tr class="admin_title">
        <td width="12%">餐厅名称</td>
        <td width="11%">主打菜</td>
        <td width="28%">餐厅地址</td>
        <td width="10%">营业时间</td>
        <td width="12%">人均消费</td>
      </tr>
      {% for r in user.rest_set.all %}
      <tr>
        <td class="rest_name" id="{{r.id}}" rel="name">{{r.name}}</td>
        <td class="rest_name" id="{{r.id}}" rel="">{{r.cuisine}}</td>
        <td class="rest_name" id="{{r.id}}">{{r.address}}</td>
        <td class="rest_name" id="{{r.id}}">{{r.open_time}}~~{{r.close_time}}</td>
        <td class="rest_name" id="{{r.id}}">{{r.spend}}</td>
      </tr>
      {% endfor %}
    </tbody></table>
    <div class="admin_index_res_info">
        <table><tbody>
        	<tr class="admin_title">
              <td colspan="3">餐厅文字介绍</td>
           </tr>
           <tr>
              <td colspan="3">
              <div class="admin_index_res_intro">
                 <textarea>{{user.rest_set.all.0.desc}}</textarea>
                 <br>
                 <span class="red3">( 字符长度不超过1800字 )</span>         
                 <div class="intro_confirm">
                 	<a href="/space/rest/{{user.rest_set.all.0.id}}/update/">编辑</a>
                 </div>
              </div>
              </td>
           </tr>  
        
           <tr>
              <td colspan="3" class="admin_res_info_title">餐厅简介 </td>
           </tr>
           <tr class="admin_title">
              <td width="35%">餐厅轮换图片</td>
              <td>图片修改</td>
              <td>操作</td>              
           </tr>
           {% for r in user.rest_set.all.0.rest_intro_img_set.all %}
           <tr>
              <td class="admin_index_res_pic">
                 <a href=""><img src="/image/{{r.img}}" width="405" height="240"></a>
              </td>
              <form method="post" action="/space/restIntroImg/{{r.id}}/update/" enctype="multipart/form-data" name="RestIntroImgForm">
	              <td class="admin_index_res_pic_edit">
	                 <input type="file" name="img" id="id_img" />	
	                 <br>
	                 <span class="red3">( 选择本地图片上传，图片尺寸为：400 x 240 )</span>
	                 <br/>                 
                 	 
              	  </td>  
              	  {% csrf_token %}
              
              <td>                 
                 <input type="submit" name="button" value="修改" />
                 <input type="button" name="button" value="删除" onClick="deleteIntro('{{r.id}}')"/>
              </td>   
              </form>   
           </tr>
           {% endfor %}
           <tr>
              <td class="admin_index_res_pic">
                 	（新增的图片） 
              </td>
              <form method="post" action="/space/{{user.rest_set.all.0.id}}/restIntroImg/" enctype="multipart/form-data" name="RestIntroImgForm">
	              <td class="admin_index_res_pic_edit">
	                 <input type="file" name="img" id="id_img" />	
	                 <br>
	                 <span class="red3">( 选择本地图片上传，图片尺寸为：400 x 240 )</span>                 
	              </td>
	              <td>                 
                 	  <input type="submit" name="button" value="上传" />
              	  </td>  
              	  {% csrf_token %}
              </form>  
           </tr>
           
            
          
          </tbody></table>     
      </div>
     <div class="admin_mer_zpc_ad" >
        <table class="zpc_ad_list"><tbody>
           <tr>
              <td colspan="3" class="admin_zpc_ad_title">招聘菜广告 </td>
           </tr>
           <tr class="admin_title">
              <td>广告图片</td>
              <td>广告词</td>
              <td width="15%">操作</td>
           </tr>
           {% for r in user.rest_set.all.0.rest_ad_img_set.all %}
           <form method="post" action="/space/restAdImg/{{r.id}}/update/" enctype="multipart/form-data" name="RestAdImgForm">
           <tr>
              <td class="admin_zpc_pic">
                 <img src="/image/{{r.img}}" >
                 <input type="file" name="img" id="id_img" />
	                 <span class="red3">( 选择本地图片上传，图片尺寸为：700 x 200 )</span>
              </td>
              <td class="zpc_ggc">
	                 <input type="text" name="ad_word" id="id_ad_word" value="{{r.ad_word}}">                 
	                 <span class="red3">( 字符长度不超过100字 )</span>
                 {% csrf_token %}
              </td>
              <td>
              	<input type="submit" name="button" value="修改" />
              	<input type="button" name="button" value="删除" onClick="deleteAd('{{r.id}}')"/>
              </td>          
          	</tr>
          	</form> 
          {%endfor%}
          <tr>
          		<form method="post" action="/space/{{user.rest_set.all.0.id}}/restAdImg/" enctype="multipart/form-data" name="RestIntroImgForm">
	          
              <td class="admin_index_res_pic">
                 	<input type="file" name="img" id="id_img" />	
	                 <span class="red3">( 选择本地图片上传，图片尺寸为：700 x 200 )</span>
              </td>
                  <td class="admin_index_res_pic_edit">
	                  
	                 <input type="text" name="ad_word" id="id_ad_word">                 
	                 <span class="red3">( 字符长度不超过100字 )</span>                
	              </td>
	              <td>                 
                 	  <input type="submit" name="button" value="新增" />
              	  </td>  
              	  {% csrf_token %}
              </form>  
           </tr>
          </tbody></table>     
     </div>
     
 {% endblock %}
